package leetcode1;

//删除有序数组重复项
public class leetcode26 {
    class Solution {
        public int removeDuplicates(int[] nums) {
            int slow = 0; int fast=0;
            while(fast<nums.length){
                if (nums[fast]!=nums[slow]){
                    nums[++slow]=nums[fast++];
                }
                else{
                    fast++;
                }
            }
            return ++slow;
        }
    }
}
